import Layout from "@/pages/Layout";
import Month from "@/pages/Layout/Month";
import Year from "@/pages/Layout/Year";
import New from "@/pages/New";
import NotFound from "@/pages/NotFount";
import { createBrowserRouter } from "react-router-dom";

// 配置路由规则
const router = createBrowserRouter([
  // 一级路由 根路由
  {
    path: "/",
    element: <Layout />,
    // 二级路由
    children: [
      {
        // path: "month",
        // 设置为默认路由
        index: true,
        element: <Month />,
      },
      {
        path: "year",
        element: <Year />,
      },
    ],
  },
  // 添加账单
  {
    path: "/new",
    element: <New />,
  },
  // 任意路由
  {
    path: "*",
    element: <NotFound />,
  },
]);

export default router;
